﻿<%@ Page Language="C#" AutoEventWireup="true" Codebehind="addinstrument.aspx.cs"
    Inherits="LabMS.Web.Equipment.Instrument.addinstrument" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>仪器入库</title>
    <link type="text/css" rel="stylesheet" href="../../style/screen.css" />
    <!--[if lte IE 6]>
    <link type="text/css" rel="stylesheet" href="../../style/ie6.css" />
    <![endif]-->
    <!--[if lte IE 7]>
    <link type="text/css" rel="stylesheet" href="../../style/ie7.css" />
    <![endif]-->

    <script src="../../js/calendar5.js" type="text/javascript"></script>

    <script type="text/javascript" src="../../js/Common.js"></script>

    <script type="text/javascript">
        function cbClick()
        {
            var obj = document.getElementById("tbInstrumentNum");
            var obj2=  document.getElementById("cbcnub");
           var obj3=  document.getElementById("MaxCID"); 
           if(obj2.checked) 
          { 
            obj.readOnly=true;
           obj.value = obj3.value; 
          }
          else
          {
            obj.readOnly=false;
          }
        }
        
        var c = new Calendar("c");
        document.write(c);
    </script>

</head>
<body class="mainBody">
    <form id="form1" runat="server">
        <div class="main">
            <div id="pageInfo" class="clearfix">
                <div class="title">
                    <label>
                        <a href="InstrumentPreview.aspx">仪器一览</a></label>&gt;仪器入库
                </div>
            </div>
        </div>
        <div class="main">
            <p>
                <asp:Button ID="lbSave" runat="server" Text="保存" OnClick="lbSave_Click" CssClass="button" />
                <input id="lbCancel" type="button" class="button" onclick="RedirectURL(window, 'InstrumentPreview.aspx')"
                    value="返回" />
                <asp:CheckBox ID="cbcnub" CssClass="checkBox" runat="server" Text="自动生成编号" />
            </p>
            <table border="0" cellpadding="4" cellspacing="0">
                <tr>
                    <td>
                        <label class="itemTitle">
                            仪器编号:</label></td>
                    <td>
                        <asp:TextBox ID="tbInstrumentNum" runat="server"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="仪器编号不能为空"
                            ControlToValidate="tbInstrumentNum"></asp:RequiredFieldValidator></td>
                    <td>
                        <label class="itemTitle">
                            分类号码:</label></td>
                    <td>
                        <asp:TextBox ID="tbKindNum" runat="server"></asp:TextBox>
                        <input id="Button2" name="btCountryselect" onclick="OpenEditWin('../Dictionary.aspx?Type=yiqi',500,400,'tbKindNum','tbInstrumentName')"
                            type="button" value="..." class="button" />
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="分类号码不能为空"
                            ControlToValidate="tbKindNum"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label class="itemTitle">
                            仪器名称:</label></td>
                    <td>
                        <asp:TextBox ID="tbInstrumentName" runat="server"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="仪器名称不能为空"
                            ControlToValidate="tbInstrumentName"></asp:RequiredFieldValidator></td>
                    <td>
                        <label class="itemTitle">
                            规格:</label></td>
                    <td>
                        <asp:TextBox ID="tbStandards" runat="server"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="规格不能为空"
                            ControlToValidate="tbStandards"></asp:RequiredFieldValidator></td>
                </tr>
                <tr>
                    <td>
                        <label class="itemTitle">
                            型号:</label></td>
                    <td>
                        <asp:TextBox ID="tbModel" runat="server"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ErrorMessage="型号不能为空"
                            ControlToValidate="tbModel"></asp:RequiredFieldValidator></td>
                    <td>
                        <label class="itemTitle">
                            国别码:</label></td>
                    <td>
                        <asp:TextBox ID="tbCountry" runat="server"></asp:TextBox>
                        <input id="btroomselect" name="btCountryselect" onclick="OpenEditWin('../Dictionary.aspx?Type=guobie',500,400,'tbStateCode','tbCountry')"
                            type="button" value="..." class="button" /></td>
                </tr>
                <tr>
                    <td>
                        <label class="itemTitle">
                            库存位置:</label></td>
                    <td>
                          <asp:TextBox ID="tbLocation" runat="server" MaxLength="40"></asp:TextBox>
                        <input id="btnWindowsLcoation" onclick="OpenEditWinOther('../Common/Location.aspx',600,400)"
                            type="button" value="..." class="button" />     
                    </td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                </tr>
                <tr>
                    <td>
                        <label class="itemTitle">
                            数量:</label></td>
                    <td>
                        <asp:TextBox ID="tbAmount" runat="server" Enabled="False">1</asp:TextBox></td>
                    <td>
                        <label class="itemTitle">
                            单价:</label></td>
                    <td>
                        <asp:TextBox ID="tbUnitPrice" runat="server"></asp:TextBox><asp:RequiredFieldValidator
                            ID="RequiredFieldValidator6" runat="server" ErrorMessage="单价不能为空" ControlToValidate="tbUnitPrice"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label class="itemTitle">
                            出厂编号:</label></td>
                    <td>
                        <asp:TextBox ID="tbFactoryCode" runat="server"></asp:TextBox></td>
                    <td>
                        <label class="itemTitle">
                            单据号:</label></td>
                    <td>
                        <asp:TextBox ID="tbDocuments" runat="server"></asp:TextBox></td>
                </tr>
                <tr>
                    <td>
                        <label class="itemTitle">
                            单位:</label></td>
                    <td>
                        <asp:DropDownList ID="ddlModle" runat="server">
                        </asp:DropDownList>
                    </td>
                    <td>
                        <label class="itemTitle">
                            来源:</label></td>
                    <td>
                        <asp:DropDownList ID="ddlSource" runat="server">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label class="itemTitle">
                            购置日期:</label></td>
                    <td>
                        <asp:TextBox ID="tbPurchaseDate" runat="server"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ErrorMessage="购置日期不能为空"
                            ControlToValidate="tbPurchaseDate"></asp:RequiredFieldValidator></td>
                    <td>
                        <label class="itemTitle">
                            出厂日期:</label></td>
                    <td>
                        <asp:TextBox ID="tbProductionDate" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label class="itemTitle">
                            创建日期:</label></td>
                    <td>
                        <asp:TextBox ID="tbCreatedDate" runat="server" Enabled="False"></asp:TextBox>
                    </td>
                    <td>
                        <label class="itemTitle">
                            使用方向:</label></td>
                    <td>
                        <asp:DropDownList ID="ddlArrow" runat="server">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label class="itemTitle">
                            状态:</label></td>
                    <td>
                        <asp:DropDownList ID="ddlPresentSituation" runat="server">
                            <asp:ListItem Selected="True">在用</asp:ListItem>
                            <asp:ListItem>多余</asp:ListItem>
                            <asp:ListItem>待修</asp:ListItem>
                            <asp:ListItem>待报废</asp:ListItem>
                            <asp:ListItem>降档</asp:ListItem>
                            <asp:ListItem>调入</asp:ListItem>
                            <asp:ListItem>转出</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                    <td>
                        <label class="itemTitle">
                            经费项目:</label></td>
                    <td>
                        <asp:DropDownList ID="ddlFundsSubject" runat="server">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label class="itemTitle">
                            仪器负责人:</label></td>
                    <td>
                        <asp:TextBox ID="tbResponesoblePerson" runat="server"></asp:TextBox>
                    </td>
                    <td>
                        <label class="itemTitle">
                            联系电话:</label></td>
                    <td>
                        <asp:TextBox ID="tbContactPhone" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr style="display: none">
                    <td>
                        <label class="itemTitle">
                            耗材类别:</label></td>
                    <td>
                        <asp:DropDownList Visible="false" ID="ddlCClass" runat="server">
                        </asp:DropDownList>
                    </td>
                    <td>
                    </td>
                    <td>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label class="itemTitle">
                            用途:</label></td>
                    <td colspan="3">
                        <asp:TextBox ID="tbPurpose" runat="server" TextMode="MultiLine" Width="475" Height="100"></asp:TextBox></td>
                </tr>
                <tr>
                    <td>
                        <label class="itemTitle">
                            仪器图片:</label>
                    </td>
                    <td>
                        <asp:FileUpload ID="imageUpload" runat="server" />
                    </td>
                </tr>
            </table>
        </div>
        <div style="display: none">
            <asp:TextBox ID="tbLocationCode" runat="server"></asp:TextBox>
        </div> 
        <input id="MaxCID" runat="server" style="display: none" type="text" />
        <asp:Label ID="lbErr" runat="server" ForeColor="Red" Text="Err" Visible="False"></asp:Label>
        <asp:TextBox ID="tbStateCode" runat="server"></asp:TextBox>
        <asp:TextBox ID="tbRoomCode" runat="server" Style="display: none"></asp:TextBox>

        <script type="text/javascript" src="../../js/jQuery/jquery-1.3.1.js"></script>

        <script type="text/javascript" src="../../js/jQuery/jquery.validate.js"></script>

        <script type="text/javascript">
         function OpenEditWinOther(frmWin,width,height) 
          {       
               var me; 
               me = window;  
               var ret = window.showModalDialog(frmWin,me,'dialogWidth='+width +'px;dialogHeight='+height+'px;help:no;status:no');
                  if (ret != null) 
                {
                    document.getElementById("tbLocation").value = ret[1];
                    document.getElementById("tbLocationCode").value = ret[0];
                }  
          } 
          function OpenEditWin(frmWin, width, height,Element1,Element2) {
          var me;
          me = window;
          var ret = window.showModalDialog(frmWin, me, 'dialogWidth=' + width + 'px;dialogHeight=' + height + 'px;help:no;status:no');
          if (ret != null) {
              if (Element2 != "NONE") {
                  document.getElementById(Element1).value = ret[0];
                  document.getElementById(Element2).value = ret[1];
              } else {
              document.getElementById(Element1).value = ret[0];
              }
                }
            }
            
            $(document).ready(function(){
            $("#form1").validate({
                rules: {
                    imageUpload:{
                        accept:'jpg|bmp|png|gif'
                    }
                },
                messages: {
                    imageUpload:{
                        accept:"请输入正确格式的图片"
                    }
                }
            });
        });
        </script>

    </form>
</body>
</html>
